<template>
  <div ref="echarts" style="width:100%;height:250px"></div>
</template>

<script>
const echarts = require('echarts')
export default {
  data () {
    return {
      healthNum: null
    }
  },
  methods: {
    initCharts () {
      const myChart = echarts.init(this.$refs.echarts)
      myChart.setOption({
        series: [
          {
            radius: "90%",
            center: ['50%', '55%'],
            type: 'gauge',
            axisLine: {
              lineStyle: {
                width: 30,
                color: [
                  [0.3, '#67e0e3'],
                  [0.7, '#37a2da'],
                  [1, '#fd666d']
                ]
              }
            },
            pointer: {
              itemStyle: {
                color: 'inherit'
              }
            },
            axisTick: {
              distance: -30,
              length: 8,
              lineStyle: {
                color: '#fff',
                width: 2
              }
            },
            splitLine: {
              distance: -30,
              length: 30,
              lineStyle: {
                color: '#fff',
                width: 4
              }
            },
            axisLabel: {
              color: 'inherit',
              distance: 40,
              fontSize: 14
            },
            detail: {
              valueAnimation: true,
              formatter: '{value}',
              color: 'inherit',
              textStyle: {
                fontSize: 18
              }
            },
            data: [
              {
                value: this.healthNum,
                name: '评分'
              }
            ]
          }
        ]
      })

      window.addEventListener("resize", () => {
        myChart.resize()
      })
    }
  },
}

</script>
<style>
</style>